package org.javaforever.gatescore.widgets;

import java.util.ArrayList;
import java.util.List;

import org.javaforever.gatescore.core.FrontDomain;
import org.javaforever.gatescore.core.FrontField;
import org.javaforever.gatescore.core.Statement;
import org.javaforever.gatescore.core.StatementList;
import org.javaforever.gatescore.core.Writeable;
import org.javaforever.gatescore.core.WriteableUtil;
import org.javaforever.gatescore.exception.ValidateException;

public class TreePanel extends Widget{
	protected FrontDomain parentTreeDomain;
	protected FrontDomain childDomain;
	protected FrontField innerTreeParentId;
	protected FrontField treeParentId;
	
	public TreePanel(FrontDomain parentTreeDomain,FrontDomain childDomain,FrontField innerTreeParentId,FrontField treeParentId) {
		super();
		this.parentTreeDomain = parentTreeDomain;
		this.childDomain = childDomain;
		this.innerTreeParentId = innerTreeParentId;
		this.treeParentId = treeParentId;
	}
	
	@Override
	public StatementList generateWidgetStatements() {
		List<Writeable> sList = new ArrayList<Writeable>();
		sList.add(new Statement(1000L,0,"<el-tree"));
		sList.add(new Statement(2000L,1,":data=\"treeData()\""));
		sList.add(new Statement(3000L,1,":default-expand-all=\"true\""));
		sList.add(new Statement(4000L,1,":check-strictly=\"true\""));
		sList.add(new Statement(5000L,1,":expand-on-click-node=\"false\""));
		sList.add(new Statement(6000L,1,":highlight-current=\"true\""));
		sList.add(new Statement(7000L,1,"ref=\"tree\""));
		sList.add(new Statement(8000L,1,"show-checkbox"));
		sList.add(new Statement(9000L,1,"node-key=\"id\""));
		sList.add(new Statement(10000L,1,"check-on-click-node"));
		sList.add(new Statement(11000L,1,"@node-click=\"nodeClick\""));
		sList.add(new Statement(12000L,1,"@check=\"nodeClick\""));
		sList.add(new Statement(13000L,0,"/>"));
		return WriteableUtil.merge(sList);
	}

	@Override
	public StatementList generateWidgetScriptStatements() throws ValidateException{
		List<Writeable> sList = new ArrayList<Writeable>();

		return WriteableUtil.merge(sList);
	}

	@Override
	public boolean parse() {
		// TODO Auto-generated method stub
		return false;
	}

	public FrontDomain getParentTreeDomain() {
		return parentTreeDomain;
	}

	public void setParentTreeDomain(FrontDomain parentTreeDomain) {
		this.parentTreeDomain = parentTreeDomain;
	}

	public FrontDomain getChildDomain() {
		return childDomain;
	}

	public void setChildDomain(FrontDomain childDomain) {
		this.childDomain = childDomain;
	}

	public FrontField getTreeParentId() {
		return treeParentId;
	}

	public void setTreeParentId(FrontField treeParentId) {
		this.treeParentId = treeParentId;
	}

	public FrontField getInnerTreeParentId() {
		return innerTreeParentId;
	}

	public void setInnerTreeParentId(FrontField innerTreeParentId) {
		this.innerTreeParentId = innerTreeParentId;
	}

}
